import { addNameSpace } from './util'

const NAME_SPACE = 'TEMPLATE_EDIT'

const addPrefix = addNameSpace(NAME_SPACE)

// 设置模板
export const SET_TEMPLATE = addPrefix('SET_TEMPLATE')

// 设置备注
export const SET_REMARK = addPrefix('SET_REMARK')

// 设置数据
export const SET_DATA = addPrefix('SET_DATA')

// 添加模板
export const ADD = addPrefix('ADD')

// 添加模板成功
export const ADD_SUCCESS = addPrefix('ADD_SUCCESS')

// 添加模板失败
export const ADD_FAIL = addPrefix('ADD_FAIL')

export const setTemplate = (template) => ({ type: SET_TEMPLATE, template })

export const setRemark = (remark) => ({ type: SET_REMARK, remark })

export const setData = (data) => ({ type: SET_DATA, data })

export const add = () => ({ type: ADD })

export const addSuccess = () => ({ type: ADD_SUCCESS })

export const addFail = () => ({ type: ADD_FAIL })

export default {
  setTemplate,
  setRemark,
  setData,
  add,
  addSuccess,
  addFail,
}